﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SharpCron
{
    public partial class Form1 : Form
    {
        int milis = 0;
        int seconds = 0;
        int minutes = 0;
        int hours = 0;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (milis < 99)
            {
                milis++;
            }
            else
            {
                milis = 0;
                if (seconds < 59)
                {
                    seconds++;
                }
                else
                {
                    seconds = 0;
                    minutes++;
                }
            }
            if (minutes == 60)
            {
                minutes = 0;
                hours++;
            }

            if (hours < 10)
            {
                lbl_h.Text = "0" + Convert.ToString(hours) + ".";
            }
            else
            {
                lbl_h.Text = Convert.ToString(hours);
            }
            if (minutes < 10)
            {
                lbl_m.Text = "0" + Convert.ToString(minutes) + ".";
            }
            else
            {
                lbl_m.Text = Convert.ToString(minutes) + ".";
            }
            if (seconds < 10)
            {
                lbl_s.Text = "0" + Convert.ToString(seconds) + ".";
            }
            else
            {
                lbl_s.Text = Convert.ToString(seconds);
            }
            if (milis < 10)
            {
                lbl_ms.Text = "0" + Convert.ToString(milis);
            }
            else
            {
                lbl_ms.Text = Convert.ToString(milis);
            }

        }

        private void button1_Click(object sender, EventArgs e)
        {
            timer1.Start();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            timer1.Stop();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            timer1.Stop();
            hours = 0;
            minutes = 0;
            seconds = 0;
            milis = 0;
            lbl_h.Text = "00.";
            lbl_m.Text = "00.";
            lbl_ms.Text = "00";
            lbl_s.Text = "00.";
        }

        private void button4_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }



    }
}
